package com.liry.security.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liry.security.domain.entity.UserRole;
import com.liry.security.repository.UserRoleRepository;
import com.liry.security.repository.mapper.UserRoleMapper;
import java.util.List;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 用戶角色表(UserRole)持久层实现
 *
 * @author ALI
 * @since 2023-05-29 21:54:14
 */
@Component
@AllArgsConstructor
public class UserRoleRepositoryImpl extends ServiceImpl<UserRoleMapper, UserRole> implements UserRoleRepository {
    @Override
    public List<UserRole> getByUserId(String userId) {
        LambdaQueryWrapper<UserRole> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(UserRole::getUserId, userId);
        return baseMapper.selectList(wrapper);
    }
}
